<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap core CSS -->
<link rel="stylesheet" type="text/css" href="../../bootstrap-3.3.7/dist/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="../../bootstrap-3.3.7/dist/css/bootstrap-theme.min.css" />
<link rel="stylesheet" type="text/css" href="../../css/index.css" />
<link rel="stylesheet" type="text/css" href="../../css/personal.css" />
<link rel="stylesheet" type="text/css" href="../../css/background.css" />
<script type="text/javascript" src="../../bootstrap-3.3.7/dist/js/jquery.min.js"></script>
<script type="text/javascript" src="../../bootstrap-3.3.7/dist/js/bootstrap.js"></script>
<!-- bootstrap表格插件 -->	
<script src="../../bootstrap-3.3.7/dist/js/bootstrap-table.js"></script>
<link href="../../bootstrap-3.3.7/dist/css/bootstrap-table.css" rel="stylesheet" />
<script src="../../bootstrap-3.3.7/dist/js/bootstrap-table-zh-CN.js"></script>
    
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<link href="../../bootstrap-3.3.7/docs/assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
</head>

<body>
	<h4 class="heading">审核知识</h4>
	<div class="myline"></div>
	<div class="col-md-12">
		<form id="formSearch" class="form-horizontal">
			<div class="form-group" style="margin-top: 15px; margin-bottom: 0px">
				<div class="col-md-5">
					<input type="text" class="form-control" id="txt_search_departmentname" placeholder="请输入题名">
				</div>
				<div class="col-md-1" style="text-align: left;">
					<button type="button" style="margin-left: 10px" id="btn_query" class="btn btn-primary">主题查询</button>
				</div>
			</div>
		</form>
	</div>
	<div class="col-md-12">
		<table id="tb_departments">
		</table>
	</div>
</body>
<script type="text/javascript">
$(function() {

    //1.初始化Table
    var oTable = new TableInit();
    oTable.Init();

    //2.初始化Button的点击事件
    var oButtonInit = new ButtonInit();
    oButtonInit.Init();
});
var TableInit = function () {
    var oTableInit = new Object();
    //初始化Table
    oTableInit.Init = function () {
        $('#tb_departments').bootstrapTable({
            url: '../information/getCheckInfo',         //请求后台的URL（*）
            method: 'get',                      //请求方式（*）
            toolbar: '#toolbar',                //工具按钮用哪个容器
            striped: true,                      //是否显示行间隔色
            cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
            pagination: true,                   //是否显示分页（*）
            sortable: true,                     //是否启用排序
            sortOrder: "asc",                   //排序方式
            queryParams: oTableInit.queryParams,//传递参数（*）
            sidePagination: "server",            //分页方式：client客户端分页，server服务端分页（*）
            pageNumber:1,                       //初始化加载第一页，默认第一页
            pageSize: 10,                       //每页的记录行数（*）
            pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
            search: false,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
            strictSearch: true,
            showColumns: true,                  //是否显示所有的列
            showRefresh: true,                  //是否显示刷新按钮
            minimumCountColumns: 2,             //最少允许的列数
            clickToSelect: true,                //是否启用点击选中行
            height: 650,                        //行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
            uniqueId: "ID",                     //每一行的唯一标识，一般为主键列
            showToggle:true,                    //是否显示详细视图和列表视图的切换按钮
            cardView: false,                    //是否显示详细视图
            detailView: false,                   //是否显示父子表
            columns : [
										{
											field : 'info_name',
											title : '题名',
											width : '35%',
											formatter : function(value, row,
													index) {
												var element = "<a  onclick='check(\""+ row.info_id+ "\")'  data-id='"+ row.id
														+ "'><span class='text-primary'>"
														+ row.info_name
														+ "</span></a>&nbsp;&nbsp";

												return element;
											}
										}, {
											field : 'info_author',
											title : '作者',
											width : '15%'
										}, {
											field : 'info_bm',
											title : '发布部门',
											width : '15%'
										}, {
											field : 'info_time',
											title : '发布时间',
											width : '15%'
										},{
											field : 'info_keyword',
											title : '关键字',
											width : '20%'
										}]
							});
		};

		//得到查询的参数
		oTableInit.queryParams = function(params) {
			var temp = { //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
				limit : params.limit, //页面大小
				offset : params.offset, //页码初始开始值
				departmentname : $("#txt_search_departmentname").val(),
				statu : $("#txt_search_statu").val()
			};
			return temp;
		};
		return oTableInit;
	};


var ButtonInit = function () {
    var oInit = new Object();
    oInit.Init = function () {
        //初始化页面上面的按钮事件
         $('#btn_query').bind('click', function() { 
        	 $('#tb_departments').bootstrapTable('refreshOptions',{pageNumber:1});
        		/* $('#tb_departments').bootstrapTable(  
                        "refresh",  
                        {  
                            url:"../information/getCheckInfo"  
                        }  
                );  */
	      });
         $('#btn_delete').bind('click', function() { 
        	var ss= $('#tb_departments').bootstrapTable("getSelections").length;
        	alert(ss);
	      });
    };

    return oInit;
};

function check(id){
	$("#refresh").load("../information/getExamineCheckview?info_id="+id);
}
 
</script>
</html>